package cn.myschool.hbase.util;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;

/**
 * @author kgc
 */
public class HBaseConfigUtil {
    /**
     * 获取配置信息类，需要指定hbase-site.xml和core-site.xml
     * 也可以通过相应的属性进行配置
     * @return
     */
    public static Configuration getHBaseConfiguration() {
        Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.quorum", "hadoopmaster");
        configuration.set("hbase.zookeeper.property.clientPort", "2181");
        configuration.set("hbase.master","hadoopmaster:2181");
        // We can also read the config from files below
        configuration.addResource(new Path("/usr/local/hbase-2.4.9/conf/hbase-site.xml"));
        configuration.addResource(new Path("/usr/local/hadoop/etc/hadoop/core-site.xml"));
        return configuration;
    }
}
